﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Exhibition.Common.Helper;
using Exhibition.Dao.ViewModel;
using Exhibition.Service;

namespace Exhibition.control
{
    public partial class selsite : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            GetSites();
        }
        private void GetSites()
        {
            StringBuilder sb = new StringBuilder();
            List<SiteModel> mdls = CenterService.siteService.GetAll();
            if (mdls.Count > 0)
            {
                foreach (var s in mdls)
                {
                    sb.AppendFormat("<li><a href='../Manage/Index.aspx?siteId={0}' target='_parent'>{1}</a><a href='../Manage/Index.aspx?siteId={0}&IsCurrent=1' target='_parent'>设为当前站</a></li>", s.Id, s.WebName);
                }
            }
            else
            {
                JsHelper.AlertAndRedirect(this.Page, "对不起，请添加站点！", "SiteDetail.aspx?rtnUrl=Index.aspx");
                return;
            }
            ltrSite.Text = sb.ToString();
        }
    }
}